<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="org.jsoft.common.DBConnection" %>
<%@ page import="org.jsoft.common.Page"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Iterator"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查询客户</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
a:link,a:visited{
 	text-decoration:none;
 	color:#006;
}
a:hover{
 text-decoration:underline;
 color:#cc0000;
}
.newfont06 {
	font-family: "宋体";
	font-size: 14px;
	color: #000000;
	text-decoration: none;
}
.right-button02 {
	font-family: "宋体";
	font-size: 12px;
	color: #174B73;
	height: 20px;
	width: 45px;
	background-image: url(../images/customer003.gif);
	border-top-width: 0px;
	border-right-width: 0px;
	border-bottom-width: 0px;
	border-left-width: 0px;
}
.right-button08 {
	font-family: "宋体";
	font-size: 12px;
	color: #174B73;
	height: 20px;
	width: 99px;
	background-image: url(../images/customer004.gif);
	border-top-width: 0px;
	border-right-width: 0px;
	border-bottom-width: 0px;
	border-left-width: 0px;
}
.right-font08 {
	font-family: "宋体";
	font-size: 12px;
	color: #555555;
	text-decoration: none;
}
a.right-font08:hover {
	font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
.newfont03 {
	font-family: "宋体";
	font-size: 12px;
	color: #000000;
	text-decoration: none;
}
a.newfont03:hover {
	font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
.newfont07 {
	font-family: "宋体";
	font-size: 13px;
	font-weight: bold;
	color: #174B73;
	text-decoration: none;
}
.tablestyle_title{
	background:#6795B4;
	padding:5px;
	text-align:left;
	color:#FFFFFF;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	height: 20px;
	font-style: normal; font-variant: normal; font-weight: bold; font-size: 16px;letter-spacing: 2px; padding-left: 10px; 
}
.right-text09 {
	font-family: Tahoma;
	font-size: 11px;
	font-weight: bold;
	color: #F26521;
	text-decoration: none;
}
.right-textfield03 {
	font-family: Tahoma;
	font-size: 11px;
	color: #555555;
	text-decoration: none;
	height: 14px;
}
.right-button06 {
	font-family: "宋体";
	font-size: 12px;
	color: #174B73;
	height: 20px;
	width: 24px;
	background-image: url(../images/customer006.gif);
	border-top-width: 0px;
	border-right-width: 0px;
	border-bottom-width: 0px;
	border-left-width: 0px;
}

html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>
</head>

<%!
	HashMap<String,String> hm;
	String dengji;
%>

<script language="JavaScript">
function selectAll(){
	var obj = document.form2.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			obj[i].checked = true;
		}
	}
}

function lianjie(dizhi){
	window.location.href(dizhi);
}
function unselectAll(){
	var obj = document.form2.elements;
	for (var i=0;i<obj.length;i++){
		if (obj[i].name == "delid"){
			if (obj[i].checked==true){
				 obj[i].checked = false;				
			}else{
				 obj[i].checked = true;		
			}
		}
	}
}
function on_load(){
	var loadingmsg=document.getElementById("loadingmsg");
	var mainpage=document.getElementById("mainpage");
	loadingmsg.style.display="";
	mainpage.style.display="none";
	
	loadingmsg.style.display="none";
	mainpage.style.display="";
}
</SCRIPT>

<body onload="on_load()">
<table id="mainpage" width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td height="30">
    <form name="form1" id="form1" method="post" action="queryCustomerServlet?flag=a">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="62" background="../images/customer001.gif">
		   <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		   	<tr>
				<td width="21"><img src="../images/customer002.gif" width="20" height="18" /></td>
				<td width="550">快速查询：&nbsp;&nbsp;姓名：
             	<input name="cusName" type="text" size="12"/>&nbsp;&nbsp;电话：
			 	<input name="cusTel" type="text" size="12"/>&nbsp;&nbsp;&nbsp;&nbsp;	
			 	<input type="submit" class="right-button02" value="查询"/></td>
		    </tr>
           </table>
        </td>
      </tr>
    </table></form></td>
  </tr>
 
  <tr>
    <td><form name="form2" method="post" action="">
    	<table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
          	 <tr>
               <td height="20"><span class="newfont07">选择：<a href="#" class="right-font08" onclick="selectAll();">全选</a>-<a href="#" class="right-font08" onclick="unselectAll();">反选</a></span>&nbsp;&nbsp;&nbsp;&nbsp;
	           <input type="submit" class="right-button08" value="删除所选用户" />&nbsp;&nbsp;&nbsp;&nbsp;
	           <a href="addCustomer.jsp"><input type="button" class="right-button08" onClick="lianjie('addCustomer.jsp')" value="添加用户"/></a></td>
          	 </tr>
             <tr>
               <td height="40">
               	<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
             		<tr>
                    	<td height="20" colspan="15" align="center" bgcolor="#eeeeee" class="tablestyle_title"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 客户信息列表 &nbsp;</td>
                    </tr>
                  	<tr bgcolor="#EEEEEE">
					    <td align="center" ><font size="2">选择</font></td>
	                    <td align="center" ><font size="2">序号</font></td>
	                    <td align="center" ><font size="2">ID</font></td>
	                    <td align="center" ><font size="2">姓名</font></td>
	                    <td align="center" ><font size="2">性别</font></td>
	                    <td align="center" ><font size="2">会员</font></td>
	                    <td align="center" ><font size="2">删除</font></td>
	                    <td align="center" ><font size="2">会员等级</font></td>
	                    <td align="center" ><font size="2">公司名称</font></td>
	                    <td align="center" ><font size="2">部门职位</font></td>	               
	                    <td align="center" ><font size="2">联系电话</font></td>
	                    <td align="center" ><font size="2">车牌车号</font></td>
	                    <td align="center" ><font size="2">最近操作的时间</font></td>	                    
	                    <td align="center" ><font size="2">备注</font></td>
	                    <td align="center" ><font size="2">操作</font></td>
	                   
                  </tr>
                 
<%
	if(!"null".equals(request.getAttribute("list"))){
		request.getRequestDispatcher("queryCustomerServlet");
	}else{
		
	}
	Page p=(Page)request.getAttribute("p");
	request.setAttribute("pageNow",p.getPageNow());
	String ziduan[]=(String[])request.getAttribute("ziduan");
	Iterator<HashMap<String,String>> iter=p.showPage(ziduan).iterator();
	while(iter.hasNext()){
		hm=iter.next();
		%>
		<tr align="center">
				   	<td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="delid" value="<%=hm.get(ziduan[0]) %>"/></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[0])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[1])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[2])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=Integer.parseInt(hm.get(ziduan[3]))==0?"男":"女"%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=Integer.parseInt(hm.get(ziduan[4]))==0?"是":"否"%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=Integer.parseInt(hm.get(ziduan[5]))==0?"是":"否"%></td>
                    
                    <%
                    	
	                    if(hm.get(ziduan[6]).equals("0")){
	                    	dengji="普通用户";
	                    }else if(hm.get(ziduan[6]).equals("1")){
	                    	dengji="一级会员";
	                    }else{
	                    	dengji="特级会员";
	                    }
                    %>
                    <td align="center" bgcolor="#FFFFFF"><%=dengji%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[7])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[8])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[9])%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[10])%></td>                                                                                    
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[11]).substring(0,hm.get(ziduan[11]).length()-2)%></td>
                    <td align="center" bgcolor="#FFFFFF"><%=hm.get(ziduan[12])%></td>
                    
                    
		<td bgcolor="#FFFFFF"><a href="customerXinXi.jsp">查看</a>|<a href="updateCustomer.jsp">编辑</a>|<a href="deleteCustomer.jsp">删除</a></td>
		</tr>
		<%
	}
%>                                                                                                                      
                </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
     </form>
    </td>
   </tr>
   <tr>
   	<td>
   	 <form name="form3" action="queryCustomerServlet?flag=b&op=dp" method="post">   
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="6"><img src="../images/customer005.gif" width="1" height="1" /></td>
        </tr>
        <tr>
          <td height="33"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="right-font08">
              <tr>
                <td width="50%">共 <span class="right-text09"><%=p.getPageCount() %></span> 页 | 第 <span class="right-text09"><%=p.getPageNow() %></span> 页</td>
                <td width="49%" align="right">[<a href="queryCustomerServlet?op=first" class="right-font08">首页</a> | <a href="queryCustomerServlet?op=up" class="right-font08">上一页</a> | <a href="queryCustomerServlet?op=next" class="right-font08">下一页</a> | <a href="queryCustomerServlet?op=end" class="right-font08">末页</a>] 转至：</td>
                <td width="1%"><table width="20" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="1%"><input name="dangqianye" type="text" class="right-textfield03" size="1" /></td>
                      <td width="87%"><input type="submit" class="right-button06" value=" "/>
                      </td>
                    </tr>
                </table></td>
              </tr>
          </table></td>
        </tr>
      </table></form></td>
  </tr>
</table>
</body>
</html>